<?php

// null object
const NONE = 0;

class Enum {  
    
    static $title = null;
    
    static function getItems() {
        $className = get_called_class();
        $classReflection = new ReflectionClass($className);
         
        return $classReflection->getConstants();  
    }
    
}

class ServiceType extends Enum {
    const ROOM                  = 1;
    const TABLE                 = 2;
    const ACCESORIE             = 3;
}

class ClientIdType extends Enum {
    const BI                    = 1;
    const PASSPORT              = 2;
    const BIRTH_CERTIFICATE     = 3;
    const DRIVER_LICENSE        = 4;
}

class AppRight extends Enum { 
    static $id = 'dashboard';
    static $title = 'Application';
    
    // application
    const SUPERADMIN            = 1;
    const ADMIN                 = 2;
    const DASHBOARD             = 3;
}

class UserRight extends Enum { 
    static $id = 'users';
    static $title = 'Human Ressources';
    
    // users
    const USER_CREATE           = 101;
    const USER_INDEX            = 100;    
    const USER_EDIT             = 102;
    const USER_DELETE           = 104;

    // roles
    const ROLE_CREATE           = 106;
    const ROLE_INDEX            = 105;
    const ROLE_EDIT             = 107;
    const ROLE_DELETE           = 109;
}

class RoomRight extends Enum { 
    static $id = 'rooms';
    static $title = 'Hotel Rooms';  
    
    // rooms
    const ROOM_CREATE           = 201;
    const ROOM_INDEX            = 200;
    const ROOM_EDIT             = 202;
    const ROOM_DELETE           = 204;

    // reservations
    const RESERVATION_INDEX     = 205;
    const RESERVATION_CREATE    = 206;
    const RESERVATION_EDIT      = 207;
    const RESERVATION_VIEW      = 208;
    const RESERVATION_DELETE    = 209;
}

class RestaurantRight extends Enum { 
    static $id = 'restaurant';
    static $title = 'Restaurant';

    // tables
    const TABLE_CREATE          = 301;
    const TABLE_INDEX           = 300;    
    const TABLE_EDIT            = 302;
    const TABLE_DELETE          = 303;

    // reservations
    const RESERVATION_CREATE    = 305;
    const RESERVATION_INDEX     = 304;
    const RESERVATION_EDIT      = 306;
    const RESERVATION_VIEW      = 307;
    const RESERVATION_DELETE    = 308;  
}

class ServiceRight extends Enum { 
    static $id = 'services';
    static $title = 'Services';
    
    // basic
    const BASIC_CREATE          = 401;
    const BASIC_INDEX           = 400;
    const BASIC_EDIT            = 402;
    const BASIC_DELETE          = 403;

    // packs
    const PACK_CREATE           = 405;
    const PACK_INDEX            = 404;  
    const PACK_EDIT             = 406;
    const PACK_DELETE           = 407;
}


class Constants {
    
    static $service_types = array(
        ServiceType::ROOM                   => 'Hotel Room',
        ServiceType::TABLE                  => 'Restaurant Table',
        ServiceType::ACCESORIE              => 'Accesorie'
    );
    
    static $clientIdTypes = array(
        ClientIdType::BI                    => 'BI',
        ClientIdType::PASSPORT              => 'Passport Id',
        ClientIdType::BIRTH_CERTIFICATE     => 'Birth Certificate',
        ClientIdType::DRIVER_LICENSE        => 'Driver License'
    );
    
    static $rights = array(
        AppRight::SUPERADMIN                    => array('name' => 'Root Account','default' => 0),
        AppRight::ADMIN                         => array('name' => 'Admin Account'),
        AppRight::DASHBOARD                     => array('name' => 'Dashboard','default' => 1,'url' => array('controller' => 'dashboard','action' => 'index')),
        
        UserRight::USER_INDEX                   => array('name' => 'Manage Accounts','url' => array('controller' => 'users','action' => 'index')),
        UserRight::USER_CREATE                  => array('name' => 'Create Account','url' => array('controller' => 'users','action' => 'create')),
        UserRight::USER_EDIT                    => array('name' => 'Edit Account'),
        UserRight::USER_DELETE                  => array('name' => 'Delete Account'),
            
        UserRight::ROLE_INDEX                   => array('name' => 'Manage Roles','url' => array('controller' => 'roles','action' => 'index')),
        UserRight::ROLE_CREATE                  => array('name' => 'Create Role','url' => array('controller' => 'roles','action' => 'create')),
        UserRight::ROLE_EDIT                    => array('name' => 'Edit Role'),
        UserRight::ROLE_DELETE                  => array('name' => 'Delete Role'),
        
        RoomRight::ROOM_INDEX                  => array('name' => 'Manage Rooms','url' => array('controller' => 'rooms','action' => 'index')),
        RoomRight::ROOM_CREATE                 => array('name' => 'Create Room','url' => array('controller' => 'rooms','action' => 'create')),
        RoomRight::ROOM_EDIT                   => array('name' => 'Edit Room'),
        RoomRight::ROOM_DELETE                 => array('name' => 'Delete Room'),
        
        RoomRight::RESERVATION_CREATE           => array('name' => 'Make Reservation','url' => array('controller' => 'reservations','action' => 'create')),
        RoomRight::RESERVATION_INDEX            => array('name' => 'Manage Reservations','url' => array('controller' => 'reservations','action' => 'index')),
        RoomRight::RESERVATION_EDIT             => array('name' => 'Edit Reservation'),
        RoomRight::RESERVATION_VIEW             => array('name' => 'Manage Reservation'),
        RoomRight::RESERVATION_DELETE           => array('name' => 'Delete Reservation'),
        
        RestaurantRight::TABLE_INDEX            => array('name' => 'Access Area','url' => array('controller' => '','action' => '')),    
        RestaurantRight::TABLE_CREATE           => array('name' => 'Create Table','url' => array('controller' => '','action' => '')),
        RestaurantRight::TABLE_EDIT             => array('name' => 'Edit Table'),
        RestaurantRight::TABLE_DELETE           => array('name' => 'Delete Table'),
        
        RestaurantRight::RESERVATION_CREATE     => array('name' => 'Make Reservation','url' => array('controller' => '','action' => '')),
        RestaurantRight::RESERVATION_INDEX      => array('name' => 'Manage Reservations','url' => array('controller' => '','action' => '')),        
        RestaurantRight::RESERVATION_EDIT       => array('name' => 'Edit Reservation'),
        RestaurantRight::RESERVATION_VIEW       => array('name' => 'Charge Reservation'),
        RestaurantRight::RESERVATION_DELETE     => array('name' => 'Delete Reservation'),

        ServiceRight::BASIC_CREATE              => array('name' => 'Create Service','url' => array('controller' => 'services','action' => 'create')),
        ServiceRight::BASIC_INDEX               => array('name' => 'Manage Services','url' => array('controller' => 'services','action' => 'index')),       
        ServiceRight::BASIC_EDIT                => array('name' => 'Edit Service'),
        ServiceRight::BASIC_DELETE              => array('name' => 'Delete Service'),

        ServiceRight::PACK_CREATE               => array('name' => 'Create ServicePack','url' => array('controller' => 'service_packs','action' => 'create')),
        ServiceRight::PACK_INDEX                => array('name' => 'Manage ServicePack','url' => array('controller' => 'service_packs','action' => 'index')),
        ServiceRight::PACK_EDIT                 => array('name' => 'Edit ServicePack'),
        ServiceRight::PACK_DELETE               => array('name' => 'Delete ServicePack')
        
    );
    
    static $domains = array('AppRight','UserRight','RoomRight','RestaurantRight',/*'ServiceRight'*/);
    
    
    /* room type constants
    const ROOM_TYPE_STANDARD                    = 1;
    const ROOM_TYPE_DOUBLE                      = 2;
    const ROOM_TYPE_FAMILY                      = 3;
    const ROOM_TYPE_DELUXE                      = 4;
    const ROOM_TYPE_MINI_SUITE                  = 5;
    const ROOM_TYPE_STANDARD_SUITE              = 6;
    const ROOM_TYPE_LARGE_SUITE                 = 7;
    const ROOM_TYPE_PENTHOUSE                   = 8;
    */
}

?>